/**
 * 
 */
package com.vision.sales.cm.serv.rpc;

import java.util.List;

import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.sencha.gxt.data.shared.loader.PagingLoadResult;
import com.vision.core.cm.db.data.Company;
import com.vision.core.cm.exception.RpcException;
import com.vision.core.cm.serv.rpc.AbstractService;
import com.vision.sales.cl.ui.component.TransactionLoadConfig;
import com.vision.sales.cm.data.TransactionStatus;
import com.vision.sales.cm.db.data.CollectionItem;
import com.vision.sales.cm.db.data.Customer;
import com.vision.sales.cm.db.data.DeliveryReceipt;
import com.vision.sales.cm.db.data.SalesInvoice;

/**
 * @author Mark
 *
 */
@RemoteServiceRelativePath("sales_invoice")
public interface SalesInvoiceService extends AbstractService<SalesInvoice> {

	List<SalesInvoice> getInvoiceNoAndIdOnly() throws RpcException;
	
	CollectionItem getSalesInvoiceSummary(long salesInvoiceId) throws RpcException;

	/**
	 * Returns the list of posted {@link SalesInvoice}s under <tt>company</tt> and <tt>customer</tt>
	 * whose balances are not yet fully settled.
	 * 
	 * @param company
	 * @param customer
	 * @return
	 * @throws RpcException
	 */
	List<SalesInvoice> getSalesInvoicesForCollection(Company company, Customer customer) throws RpcException;
	
	List<SalesInvoice> getSalesInvoicesUnderCollection(long collectionId) throws RpcException;
	
	PagingLoadResult<SalesInvoice> getList(TransactionLoadConfig config) throws RpcException;
	
	List<SalesInvoice> getSalesInvoices(TransactionStatus status) throws RpcException;
	
	List<SalesInvoice> postSalesInvoices(List<SalesInvoice> invoices) throws RpcException;

	List<DeliveryReceipt> getDeliveryReceiptsByInvoice(long salesInvoiceId) throws RpcException;
	
	List<CollectionItem> getCollectionItemsByInvoice(long salesInvoiceId) throws RpcException;
	
	List<SalesInvoice> getSalesInvoicesForAdvancePayment(long advancePaymentId) throws RpcException;
	
}